package test.day02;

import java.util.Arrays;

public class MaxArray3 {
    public static void main(String[] args) {
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100 + 1);
        }
        //System.out.println(Arrays.toString(arr));

        //冒泡排序
        for (int j = 0; j < arr.length - 1; j++) {
            for (int i = 0; i < arr.length - 1 - j; i++) {
                if(arr[i] > arr[i+1]){
                    int a = arr[i+1];
                    arr[i+1] = arr[i];
                    arr[i] = a;
                }
            }
        }
        System.out.println(Arrays.toString(arr));

    }
}
